<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title></title>
</head>
<body>
  <script>
    function fn(nums1, m, nums2, n) {
      // splice() 添加或删除数组中的元素
      nums2.splice(n, nums2.length - n)
      nums1.splice(m, nums1.length - m, ...nums2)
      nums1.sort((a, b) => a - b)
      return nums1
    }
    console.log(fn([1, 2, 3, 0, 0, 0], 3, [2, 5, 6, 0, 0, 0], 3))
  </script>
</body>
</html>